var ci;
Ext.define('AM.view.combo.ComboTip', {
    extend: 'Ext.form.field.ComboBox',
    emptyText: 'Alege tipul',
    alias: 'widget.tip',
    store: 'StoreComboTip',
    queryMode: 'local',
    valueField: "id",
    fieldLabel: 'Tip',
    displayField: "task",
	triggerAction: "all",
	editable : false,
	forceSelection: true,
	defaultCls: 'ext-color-default',
	 
     initComponent: function(){     
         this.listConfig = Ext.apply(this.listConfig || {}, {
             getInnerTpl: this.getListItemTpl
         });
         
         this.callParent(arguments);
     },
     
     // private
     getListItemTpl: function(displayField) {
         return '<div class="x-combo-list-item ext-toolscolor-{it}"><div class="ext-t-picker-icon">&#160;</div>{task}</div>';
     },
     
     // private
     afterRender: function(){
         this.callParent(arguments);
         
         this.wrap = this.el.down('.x-form-item-body');
         this.wrap.addCls('ext-tip-picker');
         
         this.icon = Ext.core.DomHelper.append(this.wrap, {
             tag: 'div', cls: 'ext-t-picker-icon ext-t-picker-mainicon'
         });
     },
     
     /* @private
      * Value can be a data value or record, or an array of values or records.
      */
     getStyleClass: function(value){
         var val = value;
         
         if (!Ext.isEmpty(val)) {
             if (Ext.isArray(val)) {
                 val = val[0];
             }
             return 'ext-toolscolor-' + (val.data ? val.data.it : val); 
         }
         return '';
     },
     
     // inherited docs
     setValue: function(value) {
         if (this.wrap && value) {
             newClass = this.getStyleClass(value);
             this.setColor(newClass);
         }
         
         this.callParent(arguments);
     },
     //Am facuto pentru a colora in combobox, la selectarea altei culori.
     setColor: function(c){
    	 this.wrap.replaceCls(ci, c);
    	 ci =c;
     }
});